package org.zjsru.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.zjsru.pojo.Payment;
import java.util.List;

public interface PaymentMapper {
    @Insert("insert into tb_payment (payment_no, order_id, user_id, amount, status, create_time, update_time) " +
            "values (#{paymentNo}, #{orderId}, #{userId}, #{amount}, #{status}, #{createTime}, #{updateTime})")
    int insert(Payment payment);

    @Update("update tb_payment set status=#{status}, pay_time=#{payTime}, update_time=#{updateTime} where id=#{id}")
    int update(Payment payment);

    @Select("select * from tb_payment where id = #{id}")
    Payment findById(@Param("id") Long id);

    @Select("select * from tb_payment where order_id = #{orderId}")
    Payment findByOrderId(@Param("orderId") Long orderId);

    @Select("select * from tb_payment where payment_no = #{paymentNo}")
    Payment findByPaymentNo(@Param("paymentNo") String paymentNo);
} 